﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using FellowshipOne.API.Model;
using FellowshipOne.API.People.Model;

namespace FellowshipOne.API.Groups.Model
{
    [Serializable]
    [XmlRoot("member")]
    public class Member : ApiModel
    {
        [XmlElement("group")]
        public Group Group { get; set; }

        [XmlElement("person")]
        public Person Person { get; set; }

        [XmlElement("memberType")]
        public MemberType MemberType { get; set; }
    }

    [Serializable]
    [XmlRoot("memberType")]
    public class MemberType : ApiModel
    {
        [XmlElement("name")]
        public string Name { get; set; }
    }

    [Serializable]
    [XmlRoot("members")]
    public class MemberCollection : Collection<Member>
    {
        public MemberCollection() { }
        public MemberCollection(List<Member> members)
        {
            if (members != null)
            {
                this.AddRange(members);
            }
        }
    }
}
